<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			//1.定义函数
			function hello(){
				document.write("Hello world!<br />")
			}
			hello();
			hello();
			function add(a,b){  //a,b形参
				var result=a+b;
				return result;
			}
			document.write("3+5="+add(3,5)+"<br />");//3,5实参
			
			//2.匿名函数
			var hello2=function(){
				document.write("Hello world!<br />");
			}
			hello2();
			var add2=function(a,b){
				var result=a+b;
				return result;
			}
			document.write("3+5="+add2(3,5)+"<br />");
			
			//3
			var add3=new Function("a","b","return a+b;");
			document.write("3+5="+add3(3,5)+"<br />");
		</script>
	</body>
</html>
